package com.yi.wood.base;

import com.yi.wood.exception.BaseException;

/**
 * Created by moyi on 2018/10/11 15:45
 *
 * @author moyi
 */
public enum GobEventEnum {
    /**
     * 加入
     */
    ADD("add"),
    /**
     * 创建
     */
    CREATE("create"),
    /**
     * 下一步
     */
    NEXT("next"),
    /**
     * 退出
     */
    EXIT("exit");

    GobEventEnum(String event) {
        this.event = event;
    }

    private String event;

    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public static GobEventEnum getEnum(String key) {
        for (GobEventEnum event : GobEventEnum.values()){
            if(event.getEvent().equalsIgnoreCase(key)){
                return event;
            }
        }
        throw new BaseException("1008");
    }
}
